<include file="header" />
<body>
<div class="wraper">
    <div class="top">
        <a href="{BEESCRM::U('base/ecs/index',array('ecs_id'=>$ecs_id))}" class="iconfont icon-zuo pull-left"></a>
    </div>
    <div class="field">申请进度</div>
   <if condition="$refund_id neq -1">
       <div class="info-box">
           <p>园 区：{BEESCRM:$community_name}</p>
           <p>楼 幢：{BEESCRM:$building_name}</p>
           <p>楼 层：{BEESCRM:$floor_name}</p>
           <p>寝室号：{BEESCRM:$room_name}</p>
           <p>姓 名：{BEESCRM:$username}</p>
           <p>手机号：{BEESCRM:$phone}</p>
           <p>退款金额：{BEESCRM:$refund_amount}&nbsp;&nbsp;&nbsp;<if condition="$is_checked eq 0"><lable style="color: #8d0001;font-size: 10px">(审核通过后显示退款金额)</lable> </if></p>
           <p>状 态：{BEESCRM:$status}</p>
       </div>
   <else/>
       没有任何申请
   </if>
    <if condition="($is_checked eq 1) and ($check_result eq 1)">
        <div class="btn-box">
            <a href="javascript:void(0)" class="btn btn-blue sure" id="sure" data-id="{BEESCRM:$refund_id}">确认无误</a>
        </div>
    <elseif condition="$is_checked eq 2"/>
        <div class="btn-box">
            <a href="{BEESCRM::U('base/ecs/refund',array('ecs_id'=>$ecs_id,'type'=>1))}" class="btn btn-blue sure" id="apply">继续申请</a>
        </div>
    </if>
	<input type="hidden" id="ecs_id" value="{BEESCRM:$ecs_id}">
</div>
<include file="commonJS" />
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    var ecs_id = $('#ecs_id').val();

    $(document).on('click','#sure',function(){
        var refund_id = $(this).data('id');

        if(!refund_id||!ecs_id){
            $.alert('error','参数错误');
            return false;
        }
        $.confirm('是否确认无误?',sure);
        function sure() {

            var info = {};
            info.refund_id = refund_id;
            info.flag = 1;
            $.ajax({
                'url': "/base/ecs/refundSure/ecs_id/"+ecs_id,
                'data': info,
                'dataType':'json',
                'type': 'POST',
                'async': false,
                success: function(data) {
                    if (data.status == 'S') {
                        reload();
                    }else{
                        $.layeralert(data.message);
                        return false;
                    }
                }
            });
        }
    });
    // 申请未通过继续申请
    $(document).on('click','#apply',function () {

        window.location.href="base/ecs/refund/ecs_id/"+ecs_id;
    });
    //刷新页面
    function reload(){
        setTimeout('location.reload()',1000);
    }
</script>
</body>
</html>